<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
  
    </style>
</head>
<body>
    <input type="text" id="a1">
    <button id="btn">插入数据</button>
    <br>
    <span id="a2"></span>
    <script>
        onload=function(){
            var arr=[2,3,7,15,19]
            a2.innerHTML=arr
            btn.onclick=function(){
                arr.push(a1.value*1)
                arr.sort(function(a,b){
                    return a-b
                })
                a1.value=""
                a2.innerHTML=arr
            }        
        }
     
        
    </script>
</body>
</html>